class Car():
    """一次模拟骑车的简单尝试"""

    def __init__(self, make, model, year):
        self.make = make
        self.model = model
        self.year = year
        self.odometer_reading = 0

    def get_descriptive_name(self):
        long_name = str(self.year) + " " + self.make + " " + self.model + ' ' + self.color
        return long_name.title()

    def read_odometer(self):
        print("This car has " + str(self.odometer_reading) + " miles on it.")

    def update_odometer(self, mileage):
        if mileage >= self.odometer_reading:
            self.odometer_reading = mileage
        else:
            print("You can't roll back an odometer!")

    def increment_odometer(self, miles):
        self.odometer_reading += miles

    def fill_gas_tank(self):
        """电动汽车没有油箱"""
        print("This car doesn't need a gas tank!")


class Battery():
    """一次模拟电动汽车电瓶的尝试"""

    def __init__(self, battery_size=70):
        """初始化电瓶的属性"""
        self.battery_size = battery_size

    def describe_battery(self):
        """打印一条描述电瓶容量的消息"""
        print("This car has a " + str(self.battery_size) + "-Kwh battery.")


class ElectricCar(Car):
    """电动汽车的独特之处"""

    def __init__(self, make, model, year, color):
        """初始化父类的属性"""
        super().__init__(make, model, year)
        self.battery_size = 70
        self.color = color
        # 将实例作为属性
        self.battery = Battery()

    # 子类新增方法
    def describe_battery(self):
        """打印一条描述电瓶容量的消息"""
        print("This car has a " + str(self.battery_size) + "-KWH Battery.")

    # 重写父类方法
    def fill_gas_tank(self):
        """电动汽车没有油箱"""
        print("I think this very well")


# my_tesla = ElectricCar('tesla', 'model 3', 2016)
my_teslaone = ElectricCar('tesla', 'model 3', 2016, 'Blue')
# print(my_tesla.get_descriptive_name())

print(my_teslaone.get_descriptive_name())
my_teslaone.describe_battery()
my_teslaone.fill_gas_tank()

my_teslaone.describe_battery()
